home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------------//
-
- // Synopsis: Grcar matrix - a Toeplitz matrix with
- // sensitive eigenvalues.
-
- // Syntax: G = grcar ( N , K )
-
- // Description:
-
- // G is an N-by-N matrix with -1s on the subdiagonal, 1s on the
- // diagonal, and K superdiagonals of 1s. The default is K = 3.
- // The eigenvalues of this matrix form an interesting pattern in
- // the complex plane (try PS(GRCAR(32))).
-
- // References:
- // J.F. Grcar, Operator coefficient methods for linear equations,
- // Report SAND89-8691, Sandia National Laboratories, Albuquerque,
- // New Mexico, 1989 (Appendix 2).
- // N.M. Nachtigal, L. Reichel and L.N. Trefethen, A hybrid GMRES
- // algorithm for nonsymmetric linear systems, SIAM J. Matrix Anal.
- // Appl., 13 (1992), pp. 796-825.
-
- // This file is a translation of grcar.m from version 2.0 of
- // "The Test Matrix Toolbox for Matlab", described in Numerical
- // Analysis Report No. 237, December 1993, by N. J. Higham.
-
- //-------------------------------------------------------------------//
-
- grcar = function ( n , k )
- {
- if (!exist (k)) { k = 3; }
- return tril(triu(ones(n,n)), k) - diag(ones(n-1,1), -1);
- };
-